﻿namespace LeetCodeProject._0001_1000._001_100._61_70._062;

public class Solution
{
    public int UniquePaths(int m, int n)
    {
        if (m < n)
            return UniquePaths(n, m);
        var paths = new int[m];
        for (int i = 0; i < m; i++)
        {
            paths[i] = 1;
        }

        for (int i = 1; i < n; i++)
        {
            for (int j = 1; j < m; j++)
            {
                paths[j] += paths[j - 1];
            }
        }

        return paths[m - 1];
    }
}